package com.ruoyi.college.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.college.mapper.SemesterMapper;
import com.ruoyi.college.domain.Semester;
import com.ruoyi.college.service.ISemesterService;
import com.ruoyi.common.core.text.Convert;

/**
 * 学期信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-25
 */
@Service
public class SemesterServiceImpl implements ISemesterService 
{
    @Autowired
    private SemesterMapper semesterMapper;

    /**
     * 查询学期信息
     * 
     * @param semesterId 学期信息主键
     * @return 学期信息
     */
    @Override
    public Semester selectSemesterBySemesterId(Long semesterId)
    {
        return semesterMapper.selectSemesterBySemesterId(semesterId);
    }

    /**
     * 查询学期信息列表
     * 
     * @param semester 学期信息
     * @return 学期信息
     */
    @Override
    public List<Semester> selectSemesterList(Semester semester)
    {
        List<Semester> semesters = semesterMapper.selectSemesterList(semester);
        return semesters;
    }

    /**
     * 新增学期信息
     * 
     * @param semester 学期信息
     * @return 结果
     */
    @Override
    public int insertSemester(Semester semester)
    {
        semester.setCreateTime(DateUtils.getNowDate());
        return semesterMapper.insertSemester(semester);
    }

    /**
     * 修改学期信息
     * 
     * @param semester 学期信息
     * @return 结果
     */
    @Override
    public int updateSemester(Semester semester)
    {
        return semesterMapper.updateSemester(semester);
    }

    /**
     * 批量删除学期信息
     * 
     * @param semesterIds 需要删除的学期信息主键
     * @return 结果
     */
    @Override
    public int deleteSemesterBySemesterIds(String semesterIds)
    {
        return semesterMapper.deleteSemesterBySemesterIds(Convert.toStrArray(semesterIds));
    }

    /**
     * 删除学期信息信息
     * 
     * @param semesterId 学期信息主键
     * @return 结果
     */
    @Override
    public int deleteSemesterBySemesterId(Long semesterId)
    {
        return semesterMapper.deleteSemesterBySemesterId(semesterId);
    }
}
